import request from '@/utils/request'

export function getPermission () {
  return request({
    url: 'menu/build',
    method: 'get'
  })
}

export const list = 'menu/list'

export function getMenus (params) {
  return request({
    url: 'menu/list',
    method: 'get',
    params
  })
}

export function getMenuSuperior (menuId) {
  return request({
    url: 'menu/superior?menuId=' + menuId,
    method: 'get'
  })
}

export function add (data) {
  return request({
    url: 'menu/add',
    method: 'post',
    data
  })
}

export function del (ids) {
  return request({
    url: 'menu/delete',
    method: 'delete',
    data: ids
  })
}

export function edit (data) {
  return request({
    url: 'menu/update',
    method: 'put',
    data
  })
}

export default { list, getMenus, getMenuSuperior, getPermission, add, del, edit }
